//
//  HomeServiceCell.m
//  CarUser
//
//  Created by 王森林 on 2018/11/30.
//  Copyright © 2018年 王森林. All rights reserved.
//

#import "HomeServiceCell.h"
#import "NewsInsureanceViewController.h"
#import "NewsMaintainViewController.h"
#import "ChooseResultViewController.h"
#import "HomeSendViewController.h"
@interface HomeServiceCell()

@end

@implementation HomeServiceCell
//- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
//    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
//        [self createUI];
//    }
//    return self;
//}

- (void)createUI
{
    UIImage *bg_maintenance = IMG(@"bg_maintenance");
    UIButton *bg_maintenanceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [bg_maintenanceBtn  setBackgroundImage:bg_maintenance forState:UIControlStateNormal];
    [bg_maintenanceBtn addTarget:self action:@selector(carMaintainAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:bg_maintenanceBtn];
    [bg_maintenanceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView.mas_left).offset(15);
        make.top.mas_equalTo(self.contentView.mas_top).offset(15);
        make.right.mas_equalTo(self.contentView.mas_centerX).offset(-5);
        make.height.mas_equalTo(IMGHEIGHT(bg_maintenance));
    }];
    
    
    UIImage *bg_insurance = IMG(@"bg_insurance");
    UIButton *bg_insuranceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [bg_insuranceBtn  setBackgroundImage:bg_insurance forState:UIControlStateNormal];
    [bg_insuranceBtn addTarget:self action:@selector(carInsuranceAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:bg_insuranceBtn];
    [bg_insuranceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView.mas_centerX).offset(5);
        make.top.mas_equalTo(self.contentView.mas_top).offset(15);
         make.right.mas_equalTo(self.contentView.mas_right).offset(-15);
        make.height.mas_equalTo(IMGHEIGHT(bg_insurance));
    }];
    
}

- (void)carMaintainAction:(id)sender
{
//    NewsMaintainViewController *controller = [[NewsMaintainViewController alloc] init];
//    controller.hidesBottomBarWhenPushed = YES;
//    [[self viewController].navigationController  pushViewController:controller animated:YES];
    ChooseResultViewController  *controller  = [[ChooseResultViewController alloc] init];
    controller.type = @"1";
    controller.pushType = 1;
    [[self  viewController].navigationController pushViewController:controller animated:YES];
    
}

- (void)carInsuranceAction:(id)sender
{
//    NewsInsureanceViewController *controller = [[NewsInsureanceViewController alloc] init];
//    controller.hidesBottomBarWhenPushed = YES;
//    [[self viewController].navigationController  pushViewController:controller animated:YES];
    HomeSendViewController *controller = [[HomeSendViewController alloc] init];
    controller.hidesBottomBarWhenPushed = YES;
    [[self viewController].navigationController pushViewController:controller animated:YES];
    
}



@end
